//
//  UIImage+exsion.swift
//  WeiBo
//
//  Created by 李立达 on 15/12/14.
//  Copyright © 2015年 heima11. All rights reserved.
//

import UIKit


extension UIImage{



  class func getInterceptScreen()->UIImage {
    
        var image = UIImage()
    
        //MARK : 获取当前的窗口
        let window = UIApplication.sharedApplication().keyWindow!
    
        //MARK : 开启当前的上下文
        UIGraphicsBeginImageContext(window.size)
    
        //MARK : 渲染上下文的内容
        window.drawViewHierarchyInRect(window.bounds, afterScreenUpdates: false)
    
    //MARK : 获取上下文的内容
        image = UIGraphicsGetImageFromCurrentImageContext()
    
        //MARK : 关闭上下文
        UIGraphicsEndImageContext()
    
        return image
    }


}
